package com.wangge.erase;

import org.junit.Test;

import com.wangge.test1.Person;

public class FinalTest {
  
  
  /** 
    * testReturn:.  <br/> 
    * @author yangqc  
    * @since JDK 1.8 
    */  
  @Test
  public void testReturn(){
  System.out.println("返回结果"+getd());//输出:返回结果5
  }
  
  /** 
    * getd: rturn a 会存储起来,执行完finally的内容之后执行该返回,. <br/> 
  
    * @author yangqc 
    * @return 
    * @since JDK 1.8 
    */  
  public int getd(){
    int a=3;
    try{
      a=5;
      return a;
    }finally{
      a=4;
      System.out.println(4);
    }
  } 
  /** 
    * test2:(这里用一句话描述这个方法的作用). <br/> 
    * 输出:0 1 2 4,
    * finally里的continue执行了,该线程结束,try里的break就不执行了.
    * @author yangqc  
    * @since JDK 1.8 
    */  
  @Test
  public void test2(){
    for(int i=0;i<5;i++){
      try {
        if(i==3){
          break;
        }
        System.out.println(i);
      } finally {
       if(i==3){
         continue;
       }
      }
    }
  }
  @Test
  public void testMod(){
    System.out.println(mod());
  }
  public Person mod(){
    Person p=new Person("qxxc","老马");
    try {
      return p;
    } finally {
     p.firstName="杨";
    }
  }
  @Test
  public void testInteger(){
    Integer y=1;
    Long x=Long.valueOf("20160508123456");
    System.out.println(x);
  }
}

